-- card: 2825 from stack: in -- bmap block id: 3489 -- flags: 0000 -- background id: 2596 -- name: -- part 9 (button) -- low flags: 00 -- high flags: 2004 -- rect: left=165 top=124 right=166 bottom=210 -- title width / last selected line: 0 -- icon id / first selected line: 20098 / 20098 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Home ----- HyperTalk script ----- on mouseUp visual effect barn door close to black visual effect barn door open to inverse go home end mouseUp -- part 8 (button) -- low flags: 00 -- high flags: 2004 -- rect: left=208 top=124 right=166 bottom=253 -- title width / last selected line: 0 -- icon id / first selected line: 13785 / 13785 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Install ----- HyperTalk script ----- on mouseUp if the optionkey is down then pass mouseup put installres(XFCN,DragRect) into it if it is empty then play boing else answer it end mouseUp -- --this function is used by the 'install' button --It then attempts to install the resource into --a target stack & returns the result. -- function installres type, resname -- --Original script by Steve Drazga, ART Incorpoated --XFCNs used: fileName, --XCMDs used: modResCopy, --HANDLERS used: none --FUNCTIONS used: none -- put (long name of this stack) into sourceStack delete first word of sourceStack delete first character of sourceStack delete last character of sourceStack put "Select a stack to copy this resource into." put filename("STAK") into fname if fname is empty then exit installres if sourcestack=fname then play "Boing" return "Get real. You can't install it in this stack" exit installres end if hide the message window -- ModResCopy sourceStack,fname,type,resname -- get the result if first char of it is "E" then play "Boing" return "Attempt to install resource has failed." else return "Resource installation successful" end if end installres -- part 10 (button) -- low flags: 00 -- high flags: 2004 -- rect: left=251 top=124 right=166 bottom=296 -- title width / last selected line: 0 -- icon id / first selected line: 6347 / 6347 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Show Code ----- HyperTalk script ----- on mouseUp show card field code show card button "Hide Code" show card button "Hide Code 1" end mouseUp -- part 3 (field) -- low flags: 80 -- high flags: 0004 -- rect: left=118 top=69 right=272 bottom=364 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: DragRectangle -- part 1 (button) -- low flags: 80 -- high flags: 8002 -- rect: left=118 top=69 right=92 bottom=362 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: _____ Please Drag Me _____ ----- HyperTalk script ----- -- -- Draggable window simulation, ©1988 by Richard P. Davis. Use it -- as you please with this notice intact. If you make improvements, -- please distribute them on the networks. -- on mouseDown put the loc of card button id 1 into oldloc -- remember the locations put the loc of card field id 3 into backloc -- of the elements of the put the loc of card field id 4 into textloc -- window so we can change put the loc of card button id 6 into awayloc -- change them all at the if the optionkey is down then -- same time. put 1 into constraint -- if the option key or else if the commandkey is down then -- the command key are put 2 into constraint -- held down, constrain else -- the movement of the put 0 into constraint -- drag to horizonal or end if -- vertical only. -- -- Use the XFCN to drag the rectangle of our window around, starting -- from the ClickLoc. The XFCN returns the offset from the clickloc -- as its result if all goes well, or "False" if an error occurs. -- put DragRect(the clickloc, the rect of card field id 3, constraint) into newLoc -- -- Now we need to move all of the parts of our window, the background -- field we use to get the rect from, the button we use as the title -- bar, the scrolling field we use as the content region, and the -- button we use for a go away box. Use lockscreen to make them look -- as if the all move at once. -- if newLoc is not "False" then set lockscreen to true add item 1 of newLoc to item 1 of oldLoc add item 2 of newLoc to item 2 of oldLoc set the loc of me to oldLoc add item 1 of newLoc to item 1 of backloc add item 2 of newLoc to item 2 of backloc set the loc of card field id 3 to backLoc add item 1 of newLoc to item 1 of textloc add item 2 of newLoc to item 2 of textloc set the loc of card field id 4 to textLoc add item 1 of newloc to item 1 of awayloc add item 2 of newloc to item 2 of awayloc set the loc of card button id 6 to awayLoc set lockscreen to false else play "Boing" -- If there was a problem doing the drag, play end if -- Boing at the customer... end mouseDown -- part 6 (button) -- low flags: 80 -- high flags: 0000 -- rect: left=125 top=75 right=87 bottom=137 -- title width / last selected line: 0 -- icon id / first selected line: 14184 / 14184 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Go Away ----- HyperTalk script ----- -- -- Draggable window simulation, ©1988 by Richard P. Davis. Use it -- as you please with this notice intact. If you make improvements, -- please distribute them on the networks. -- on mouseUp set lockscreen to true put the mouseloc into mloc put item 1 of the rect of me into left -- decompose the rect of put item 2 of the rect of me into top -- the button for easier put item 3 of the rect of me into right -- comparison purposes. put item 4 of the rect of me into bottom -- -- If the mouse was released within the goawaybox, hide all of the -- window elements. That is why we have the lockscreen on, so the -- whole window appears to go away at once. -- if item 1 of mloc > left and item 1 of mloc < right and item 2 of mloc > top and item 2 of mloc < bottom then hide card button id 1 hide card button id 6 hide card field id 3 hide card field id 4 show card button id 2 end if set lockscreen to false end mouseUp -- -- This handler used in place of TrackGoAway to keep hiliting and -- unhiliting the GoAwayBox until the user makes up their mind. -- on mouseDown set the icon of me to 26211 -- hilited version of icon put item 1 of the rect of me into left -- decompose the rect of put item 2 of the rect of me into top -- the button for easier put item 3 of the rect of me into right -- comparison purposes. put item 4 of the rect of me into bottom -- -- The following loop will track the mouse movement until the user -- releases the mouse button. When the mouse is within the GoAwayBox -- the GoAwayIcon will be the Hilited version, but whenever the mouse -- leaves the box, that icon will be replaced by its nonhilited -- cousin. -- repeat while the mouse is down if the mouseh < left or the mouseh > right or the mousev < top or the mousev > bottom then set the icon of me to 14184 else set the icon of me to 26211 end if end repeat set the icon of me to 14184 -- End up with the unhilited version. end mouseDown -- part 4 (field) -- low flags: 81 -- high flags: 2007 -- rect: left=118 top=91 right=270 bottom=362 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 768 -- line height: 16 -- part name: TextRectangle -- part 13 (button) -- low flags: 80 -- high flags: 2000 -- rect: left=251 top=124 right=165 bottom=295 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Hide Code 1 ----- HyperTalk script ----- on mouseUp set lockscreen to true hide card field "Code" hide card button "Hide Code" hide card button "Hide Code 1" set lockscreen to false end mouseUp -- part 2 (button) -- low flags: 00 -- high flags: A004 -- rect: left=165 top=164 right=202 bottom=296 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Push for demo ----- HyperTalk script ----- on mouseUp set lockscreen to true hide card field code hide card button "Hide Code" hide card button "Hide Code 1" show card button id 1 show card button id 6 show card field id 3 show card field id 4 set scroll of card field id 4 to 0 hide card button id 2 set lockscreen to false end mouseUp -- part 11 (field) -- low flags: 80 -- high flags: 2004 -- rect: left=135 top=71 right=289 bottom=343 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: code -- part 12 (button) -- low flags: 80 -- high flags: 0000 -- rect: left=134 top=71 right=289 bottom=342 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Hide Code ----- HyperTalk script ----- on mouseUp set lockscreen to true hide card field "Code" hide card button "Hide Code" hide card button "Hide Code 1" set lockscreen to false end mouseUp -- part contents for card part 4 ----- text ----- This draggable window was easily created using the DragRect XFCN. Look at the card button called “Please Drag Me” to see how it was done. Try dragging the window as you would any standard Macintosh window. Also try dragging the window with the option key held down, or with the command key held down. The DragRect XFCN is free of charge for noncommercial use only. If you would like to license it (with C source) for use in a commercial or shareware product, please call or write to: Richard P. Davis 260 Sheridan St. #100 Palo Alto, Ca. 94306 (415) 324-9333 ©1988 Richard P. Davis -- part contents for card part 11 ----- text ----- Send $15.00 for the heavily commented LightSpeed C source code for the DragRect XFCN, and other XFCN’s and XCMD’s to: Richard P. Davis 260 Sheridan St. #100 Palo Alto, Ca. 94306 The source files will be provided on an 800K diskette unless otherwise requested.